﻿<!DOCTYPE html>
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <meta name="viewport" content="width=device-width" />
    <meta name="renderer" content="webkit" />
    <meta charset="utf-8" />
    <title>闪Q空间·物联应用平台</title>

    <link href="/UI/css/base.min.css" rel="stylesheet" />
    <link href="/UI/css/index.min.css" rel="stylesheet" />
</head>
<body>
    <div id="site-navi" class="row SiteNavi">
        <div class="col-lg-6 col-lg-offset-6" content-src="/UI/components/sitenavi.html">

        </div>
    </div>
    <div id="loginBk">

    </div>
    <section id="section1">
        <!--登录区域-->
        <form class="row">
            <div id="loginform-container" v-if="!User">
                <loginform v-on:onloginend="onLoginEnd"></loginform>
            </div>
            <div id="user-logined-panel" class="col-lg-2 col-lg-offset-8" v-else>
                <div id="ulp-himg" :style="{backgroundImage:'url('+User.headimg+')'}">

                </div>
                <h4 style="color:white">欢迎，{{User.name}} </h4>
                <a id="ulp-enter" class="btn onfocus LinkBlock" href="/FlashQ/Home.html"><i class="soicon icon-send"></i> 进&nbsp;入&nbsp;平&nbsp;台</a>
            </div>
        </form>
    </section>
    <!--<section id="section2">

    </section>
    <section id="section3">

    </section>
    <section id="section4">

    </section>
    <section id="section5">

    </section>-->
    <div content-src="/ui/components/pagehelper.html" replace="true">
    </div>
    <div content-src="/ui/components/sitefoot.html">
    </div>


    <script src="/scripts/baseJS.min.js"></script>
    <script>
        $$.LoadVue('/UI/components/v_loginform.html', 'loginform');
        var opt = {
            ticking: false,
            elm_loginBk: null,
            loginSecHeight: null,
            loginBkOffset: 0,
            headFixed: false,
            el: '#section1',
            data: {
                User: null
            },
            methods: {
                onLoginEnd: function (rtn) {
                    var frm = getUrlParam("from");
                    if (!frm && document.referrer) {
                        frm = document.referrer;
                    };
                    if (frm) {
                        window.location = frm;
                    }
                    else {
                        window.location = "/FlashQ/Home.html";
                    }

                }
            }
        };

        onWndScroll = function (ev) {
            if (!opt.ticking) {
                requestAnimationFrame(onWndScrollRaw);
                opt.ticking = true;
            }
        };

        onWndScrollRaw = function () {
            //处理视察滚动效果
            var sTop = document.documentElement.scrollTop || document.body.scrollTop;

            //处理头部导航条
            if (sTop >= 100 && !opt.headFixed) {
                opt.headFixed = true;
                document.getElementById("site-navi").classList.add("fix");
            }
            else if (sTop < 100 && opt.headFixed) {
                opt.headFixed = false;
                document.getElementById("site-navi").classList.remove("fix");
            }
            else { }

            //处理登录背景图
            opt.elm_loginBk.style.top = sTop > 0 ? (0 - sTop / 2 + 'px') : '0px';

            opt.ticking = false;
        };

        $(function () {
            opt.elm_loginBk = document.getElementById("loginBk");
            vIndex = new Vue(opt);
            window.addEventListener("scroll", onWndScroll);

            //检查登录状态
            $$.Login(function (usr) {
                vIndex.User = usr;
            }, function () { });
        });
    </script>
</body>
</html>
